{include file=header.html}
<script language="javascript" type="text/javascript" src="{lib file=jquery.ui/jquery.ui.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=DatePicker/WdatePicker.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/fabric_info.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/jquery.funkyUI.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/common.js}"></script>
<script language="javascript" type="text/javascript" src="{lib file=jquery.plugins/jquery.validate_1.11.0.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/select.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/auto_textarea.js}"></script>
<style type="text/css">
.btn-2{margin-bottom:5px;}
.table_no_border,.table_no_border td,.table_no_border th{
	padding:0;
	margin:0;
	border-width:0 1px 0 0;
	}
.fabric_info_list td input,.fabric_info_list td select{width:93%;}
.fabric_info_table td,.fabric_info_table th{
	border-left:none;
	border-bottom:none;
	}
.fabric_info_table th
{
   border-top:none;
}
.tab-display .no_right_border
{
	border-right:none;
}
.fabric_info_table .btn-2{
	line-height:20px;
	height:20px;
	margin-bottom:1px;}
.img_border{
	border: 2px solid #000000;width: 80px;height: 60px;
}
#sample_filesize {width:100px;word-wrap: break-word;word-break: normal;word-break:break-all;}
</style>
<script type="text/javascript">
$(function() {
	
	 $('#sample_form').validate({
        onkeyup : false,
		onfocusout : false,
        rules : {
			//arrival_date: {
				//required: true,
				//dateISO: true
			//},
			/* brand_id: {
				min: 1
			}, */
			buyer_id: {
				required: true,
				min: 1
			},
			merchandiser_id: {
				min: 1
			},
			sample_sn: {
				required: true
			}
			//ref_sample_style:{
				//min: 1
			//}
        },
        messages : {
			//arrival_date: {
				//required: '{$lang.arrival_date_not_empty}',
				//dateISO: '{$lang.date_format_error}'
			//},
			/* brand_id: {
				min: '{$lang.brand_select_pls}'
			}, */
			buyer_id: {
				required: '{$lang.buyer_select_pls}',
				min: '{$lang.buyer_select_pls}'
			},
			merchandiser_id: {
				min: '{$lang.merch_select_pls}'
			},
			sample_sn: {
				required: '{$lang.sample_sn_not_empty}'
			}
			//ref_sample_style: {
				//min: '{$lang.ref_sample_style_select_pls}'
			//}
        }
    });
	
	$('select[select_input="select_input"]').each(function(i) {
		init_select_input($(this));
	});
	$('div.select-input').each(function(i) {
		$(this).css('z-index', $('div.select-input').length - i);
	});
	$('#add_fabric_info').click(function() {
		var tr = $('<tr><th align="right">{$lang.desc}：</th><td class="tab-align-l" colspan="3"></td><th align="right">{$lang.fabric_shop_name}：</th><td class="tab-align-l" colspan="3"></td><td colspan="2" align="left"></td></tr>');
		var sel_input = $($('#fabric_shop_data').html());
		sel_input.attr('select_input', 'select_input');
		sel_input.attr('name', 'new_fabric_info[][fabric_shop_id]');
		sel_input.attr('id', 'new_fabric_info[][fabric_shop_id]');
		sel_input.attr('class', 'input-3');
		var desc = $('<input type="text" class="input-3" name="new_fabric_info[][description]">');
		tr.find('td:eq(0)').append(desc);
		tr.find('td:eq(1)').append(init_select_input(sel_input));
		$('div.select-input').each(function(i) {
			$(this).css('z-index', $('div.select-input').length - i);
		});
		tr.css('background-color', '#F4F8FA');
		var add_fabric_shop = $('#add_fabric_shop');
		tr.insertAfter(add_fabric_shop.parents('tr'));
		if ($('input.btn-2[value="移除"]').length < 1) {
			add_fabric_shop.parent().append($('<input type="button" value="移除" class="btn-2" />'));
		}
		tr.find('td:eq(2)').append($('<input type="button" value="移除" class="btn-2" />'));
		tr.find('td:eq(2)').append(add_fabric_shop);
	//	$('input.btn-2[value="移除"]').click(function() {
	//		remove_fabric_shop($(this));
	//	});
		sort_new_fabric_info();
	});

	$('#add_fabric_shop').click(function() {
		var value = $.trim(prompt("请输入布行/档口名称：", ''));
		if (value != '' && confirm('系统将增加此布行信息到系统，请确认是否重复。\r\n' + value + '\r\n确定要添加该布行吗？')) {
			$.post('index.php?app=fabric_shop&act=AjaxAdd', {'fabric_shop_name' : value}, function(json) {
				if (json.done) {
					ref_fabric_shop();
				}
				alert(json.msg);
			}, 'json');
		}
	});
	$('input[acttype="confirm"]').click(function() {
		if (confirm('是否已经保存信息？更新样板信息之后将会使已确认样板状态无效。\r\n\r\n是否继续？')) {
			$.getJSON('index.php?app=sample&act=confirm&id={$smarty.get.id}', function(json) {
				alert(json.msg);
			});
		}
	});
	
});

function sort_new_fabric_info()
{
	$('input[name^="new_fabric_info"][name$="[description]"]').each(function(i) {
		$(this).attr('name', 'new_fabric_info[' + i + '][description]');
	});
	$('input[name^="new_fabric_info"][name$="[fabric_shop_id]"]').each(function(i) {
		$(this).attr('name', 'new_fabric_info[' + i + '][fabric_shop_id]');
		$(this).attr('id', 'new_fabric_info[' + i + '][fabric_shop_id]');
	});
}

function remove_fabric_shop(_this)
{
	var fid=$(_this).attr('f_id');
	if (!confirm('确定要移除该面料信息吗？')) {
		return;
	}else{
		$.ajax({
			url:'index.php?app=sample&act=drop_fabric&fab_id='+fid,
			type:'get',
			dataType:'json',
			error:function(){
				alert('网络连接错误，请稍后再试');
			},
			success:function(data){
				if(data.flag){
					$(_this).parent().parent().remove();
				}else{
					alert('网络连接错误，请稍后再试');
					return;
				}
			}
		});
	}
}

function addbuff()
{

	var buff=encodeURI($("#add_buff").val());
	if(buff!="")
	{
		var url="{$site_url}/index.php?app=sample&act=addrecord&id={$sample.sample_id}&buff="+buff;
		$.getJSON(url,function(ret){
				if(ret.done)
				{
					$("#add_buff").val("");
					if($("#record_list p").size()>0)
					{
					$("#record_list p:first").before(ret.retval);
					}
					else
					{
					$("#record_list").append(ret.retval);
					}
				}
				else
				{
					alert(ret.msg);
				}
			
			});	
	}
}

function check_factory_submit(){

	if(confirm('请仔细检查填写内容是否正确，确认是否提交？')==true){
		if($("[name='factory_price']").val()=="")
		{
			alert("请输入工厂报价");
			return false;
		}
		
		if($("#factory_files a").size()==0)
		{
			alert("请上传报价单");
			return false;
		}
		var ml_num=0;
		$(".fabric_info_list").each(function(){
				
			if($(this).find("[item='fabric_shop_name']").val()!=0 && $(this).find("[item='item']").val()!=0 && $(this).find("[item='fabric_characteristics']").val()!="")
			{
				ml_num++;
			}
		});
		
		if(ml_num==0)
		{
			alert("请输入面料信息");
			return false;
		}
		
	}else{
		return false;
	}
	
	return true;
}

function check_desc()
{
	
	if($("#approve_no_desc").val()=="")
	{
		$.funkyUI({url:"index.php?app=sample&act=approve_not_pass",css:{width:"455",height:"330"}});
		return false;
	}
	return true;
}

function re_factory()
{
	
	if($("#return_factory_desc").val()=="")
	{
		$.funkyUI({url:"index.php?app=sample&act=return_factory",css:{width:"455",height:"330"}});
		return false;
	}
	return true;
}

function get_sours(){
	var url="index.php?app=purchase&act=index&sid={$sample.sample_id}";
	location.href=url;
}

function assign_factory_quote(){
	var url="index.php?app=quote&act=quote_info&sample_id={$sample.sample_id}";
	location.href=url;
}

//面料需求
function assign_merch_fabric(){
	var url="index.php?app=merchant&act=merch_fabric&sample_id={$sample.sample_id}";
	location.href=url;
}

//检查工厂做货量
function check_goods_num(){
	var id=$("#factory_id").val();
	var mydate=new Date();
	var year=mydate.getFullYear();
	var month=mydate.getMonth()+1;
	$.ajax({
		url:'index.php?app=order&act=check_order_goods_num&factory_id='+id+'&year='+year+'&month='+month,
		type:'get',
		dataType:'json',
		error:function(){
			alert('网络连接错误，请稍后再试');
		},
		success:function(data){
			if(data.flag){
				alert(data.msg);
			}else{
				alert(data.msg);
			}
		}
	});
}

//提交时弹出工厂生产量信息
function check_product_sub(){
	var id=$("#factory_id").val();
	var mydate=new Date();
	var year=mydate.getFullYear();
	var month=mydate.getMonth()+1;
	$.ajax({
		url:'index.php?app=order&act=check_order_goods_num&factory_id='+id+'&year='+year+'&month='+month,
		type:'get',
		dataType:'json',
		success:function(data){
			alert(data.msg);
		}
	});
	if(confirm('确认审批通过吗?')!=true){
		return false;
	}
}

//设为默认
function defaultImage(obj,id,sample_id) {
	$.ajax({
		url: 'index.php?app=sample&act=default_image&id=' + id + '&sample_id='+sample_id+'&ajax=1',
		type: 'GET',
		timeout: 1000,
		dataType:'json',
		error: function () {alert('网络连接错误，请稍后再试');},
		success: function (data) {
			if (data.done) {
				alert(data.msg);
				obj.parent().addClass('img_border').siblings().removeClass('img_border');
			}else{
				alert(data.msg);
			}
		}
	});
}
</script>
<body>
<div id="fabric_shop_data" style="display:none;"><select><!--{foreach from=$fabricshop_list item=fabric_shop}--><option value="{$fabric_shop.fabric_shop_id}">{$fabric_shop.fabric_shop_name|escape}</option><!--{/foreach}--></select></div>
<div class="sub-body">
      
  <div class="tab-frame" style="width:900px;">
  <h3 class="tab-title-1"><span>{$lang.sample_more_info}</span></h3>
		<form method="post" id="sample_form" action="{url app=sample&act=$smarty.get.act&id=$smarty.get.id}">
    <table width="100%" cellspacing="0" cellpadding="0" class="tab-display">
    <tr>
      <th style="width:100px;" align="right">{$lang.status}：</th>
      <td class="tab-align-l">{$lang.statuies.$sample.status}</td>
      <th colspan="4">{$lang.front_pic}</th>
		<th colspan="4">{$lang.other_pic}</th>
      </tr>
      <tr>
        <th align="right">{$lang.arrival_date}：</th>
        <td class="tab-align-l">
        {if $user.is_factory neq 1}
        <input {if $user.is_factory eq 1}disabled{/if} type="text" name="arrival_date" id="arrival_date" class="input-1"  onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="{$sample.arrival_date|date:Y-m-d}"/>
        {else}
        {$sample.arrival_date|date:Y-m-d}
        {/if}
          </td>
          <td colspan="4" rowspan="11"><img src="{$sample.front_pic}" id="front_pic_show"  width="220" height="264" /><input type="hidden" name="front_pic" id="front_pic" value="" onChange="document.getElementById('front_pic_show').src=this.value;" />
        <input type="hidden" name="front_pic_small" id="front_pic_small" value="" /></td>
		<td colspan="4" rowspan="11"><img src="{$sample.other_pic}" id="other_pic_show"  width="220" height="264" /><input type="hidden" name="other_pic" id="other_pic" value="" onChange="document.getElementById('other_pic_show').src=this.value;" /></td>
      </tr>
      <tr>
        <th align="right">{$lang.sample_sn}：</th>
        <td class="tab-align-l">
         {if $user.is_factory neq 1}
                <input {if $user.is_factory eq 1}disabled{/if} type="text" name="sample_sn" id="sample_sn" value="{$sample.sample_sn}" class="input-1" />
        {else}
        {$sample.sample_sn}
        {/if}
          </td>
      </tr>
      <tr>
        <th align="right">{$lang.ref_sample_style}：</th>
        <td class="tab-align-l">
         {if $user.is_factory neq 1}
          <select {if $user.is_factory eq 1}disabled{/if} style="width:150px;" name="ref_sample_style" id="ref_sample_style">
            <option value="0">{$lang.select_pls}</option>
            <!--{foreach from=$lang.ref_sample_styles item=item key=k}-->
            <option {if $k eq $sample.ref_sample_style}selected{/if}  value="{$k}">{$item}</option>
            <!--{/foreach}-->
          </select>
        {else}
        <!--{foreach from=$lang.ref_sample_styles item=item key=k}-->
            {if $k eq $sample.ref_sample_style}{$item}{/if}
            <!--{/foreach}-->
        {/if}
          </td>
      </tr>
      <tr>
        <th align="right">{$lang.brand_name}：</th>
        <td class="tab-align-l">
       {if $user.is_factory neq 1}
           <select  style="width:150px;" {if $user.is_factory eq 1}disabled{/if} name="brand_id" id="brand_id" onChange="brand_change(this.value);">
            <option value="0">{$lang.select_pls}</option>
            <!--{foreach from=$brand_list item=brand key=k}-->
            <option {if $brand.brand_id eq $sample.brand_id}selected{/if} value="{$brand.brand_id}">{$brand.brand_name}&nbsp;&nbsp;({$brand.company_name|escape})</option>
            <!--{/foreach}-->
          </select>
        {else}
        <!--{foreach from=$brand_list item=brand key=k}-->
          {if $brand.brand_id eq $sample.brand_id}{$brand.brand_name}({$brand.company_name|escape}){/if}
            <!--{/foreach}-->
        {/if}
          
          </td>
      </tr>

      <tr>
        <th align="right">{$lang.buyer_name}：</th>
        <td class="tab-align-l">
         {if $user.is_factory neq 1}
          <select {if $user.is_factory eq 1}disabled{/if} style="width:150px;" name="buyer_id" id="buyer_id" onChange="buyer_change(this.value);">
            <option value="0">{$lang.select_pls}</option>
            <!--{foreach from=$buyer_list item=buyer}-->
            <option {if $buyer.user_id eq $sample.buyer_id}selected{/if}  value="{$buyer.user_id}">{$buyer.user_name}</option>
            <!--{/foreach}-->
          </select>
          {else}
           <!--{foreach from=$buyer_list item=buyer}-->
          {if $buyer.user_id eq $sample.buyer_id}{$buyer.user_name}{/if} 
            <!--{/foreach}-->
           {/if}
          </td>
      </tr>
   
      <tr>
        <th align="right">{$lang.merchandiser}：</th>
        <td class="tab-align-l">        
         {if $user.is_factory neq 1}
          <select {if $user.is_factory eq 1}disabled{/if} style="width:150px;" name="merchandiser_id" id="merchandiser_id">
            <option value="0">{$lang.select_pls}</option>
            <!--{foreach from=$merchandiser_list item=merchandiser}-->
            <option {if $merchandiser.user_id eq $sample.merchandiser_id}selected{/if} value="{$merchandiser.user_id}">{$merchandiser.user_name}</option>
            <!--{/foreach}-->
          </select>
        {else}
        <!--{foreach from=$merchandiser_list item=merchandiser}-->
            {if $merchandiser.user_id eq $sample.merchandiser_id}{$merchandiser.user_name}{/if}
            <!--{/foreach}-->
        {/if}
          </td>
      </tr>
      <tr>
        <th align="right">{$lang.style_name}：</th>
        <td class="tab-align-l">
        {if $user.is_factory neq 1}
           <select name="style_id" style="width:150px;" class="chzn-select">
            <option value="0">{$lang.select_pls}</option>
			<!--{foreach from=$style_list item=style}-->
            <option value="{$style.style_id}" {if $sample.style_id == $style.style_id}selected{/if}>{$style.style_name|escape}</option>
			<!--{/foreach}-->
          </select>
        {else}
        	<!--{foreach from=$style_list item=style1}-->
            {if $sample.style_id == $style1.style_id}{$style1.style_name|escape}{/if}
			<!--{/foreach}-->
         {/if} 
         </td>
      </tr>
      <tr>
       <th align="right">{$lang.factory_name}：</th>
        <td class="tab-align-l">
        {if $user.is_factory neq 1}
        <select name="factory_id" id="factory_id" style="width:150px;" val="{$sample.factory_id}" num="5" onchange="check_goods_num()">
        <option value="0">{$lang.select_pls}</option>
		  <!--{foreach from=$factory_list item=factory}-->
          <option value="{$factory.factory_id}" {if $sample.factory_id == $factory.factory_id}selected{/if}>{$factory.factory_name|escape}</option>
		  <!--{/foreach}-->
        </select>
        {else}
        {$sample.factory_name|escape}
        {/if}
        </td>
      </tr>
      <tr>
          <th align="right">{$lang.to_factory_date}：</th>
        <td class="tab-align-l">
        {if $user.is_factory neq 1}
		<input type="text" name="to_factory_date" id="to_factory_date" class="input-1"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="{$sample.to_factory_date|date:Y-m-d}" />
        {else}
        {$sample.to_factory_date|date:Y-m-d}
        {/if}
        </td>
      </tr>
      
      <tr>
          <th align="right">{$lang.send_sample_date}：</th>
        <td class="tab-align-l">
        {if $user.is_factory neq 1}
       <input type="text" name="send_sample_date" id="send_sample_date" class="input-1"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="{$sample.send_sample_date|date:Y-m-d}" />
       {else}
       &nbsp;
        {/if}
       </td>
      </tr>
     
      <tr>
        <th align="right">{$lang.order_sn}：</th>
        <td class="tab-align-l">
        {if $user.is_factory neq 1}
        <input type="text" name="order_sn" class="input-1" value="{$sample.order_sn|escape}" />
        {else}
        {$sample.order_sn|escape}
        {/if}
        </td>
       
      </tr>
      {if $user.is_factory neq 1}
      <tr>
      	<th align="right">{$lang.consumer_price}：</th>
        <td class="tab-align-l">
        	<!-- {if $user.role==USER_MERCHANDISER || $user.role==USER_MANAGER || $user.role==USER_FINANCE || $user.role==USER_MERCHANDISER_ADMIN} -->
        	<input type="text" name="consumer_price" class="input-1" value="{$sample.consumer_price|escape}" />
        	<!-- {else} -->
        	{$sample.consumer_price|escape}
        	<!-- {/if} -->
        </td>
        <td colspan="8"><input type="button" id="upload_pics" class="btn-3" value="{$lang.update_pics}" onClick="block({$sample.sample_id})"/></td>
      </tr>
      {/if}
 	  <!-- <tr>
 	  	<th align="right">纸样：</th>
      	<td colspan="9" id="sample_pattern_file" align="left"> 
      		{if $user.role==USER_FACTORY}
	       	<input type="button" class="btn-3" value="{$lang.upload_enclosure}" onClick="upload_docs({$belongs_sample_pattern},{$sample.sample_id});" /><br />
	       	{/if}
	        {foreach from=$sample.sample_pattern item=file}
			<span><a href="download.php?id={$file.file_id}" style="color:blue">{$file.file_name}</a>
			{if $user.role==USER_FACTORY}
	        	<a class="pic_del" style="color:blue"  href="{url app=comupload&act=delete&id=$file.file_id}" onClick="return confirm('{$lang.confirm_del_file}')" title="{$lang.delete}">&nbsp;</a>
	        {/if}
	        &nbsp;&nbsp;{if !$smarty.foreach.last}</span>{/if}
			{/foreach}
		</td>
 	  </tr> -->
 	  
      <!-- {if $user.role!=USER_FACTORY} -->
      <tr>
        <th align="right">{$lang.detail_thumb}：</th>
      	<td align="left"><a href="{url app=sample&act=upload_thumb&sample_id=$sample.sample_id}">查看</a></td>
      	<th align="right">{$lang.recomm_color}：</th>
      	<td align="left" colspan="3"><a href="{url app=colorcard&act=recomm_view&sample_id=$sample.sample_id}">查看</a></td>
 	 	<th align="right">{$lang.factory_upload}：</th>
      	<td colspan="3" align="left">{if $user.role==USER_CIVILIAN || $user.role==USER_MANAGER}<input name="factory_upload" value="1" {if $sample.factory_upload}checked="checked"{/if} type="checkbox" />{else}<input name="is_upload" readonly="readonly" type="checkbox" {if $sample.factory_upload}checked="checked"{/if} />{/if}</td>
 	  </tr>
      <tr>
        <th rowspan="2" align="right">{$lang.customer_reviews}：</th>
      	<td colspan="9" align="left">
       
        <textarea style="width:99%; height:50px;" id="customer_reviews" name="customer_reviews" <!-- {if $user.role!=USER_CLIENT} -->readonly<!-- {/if} -->>{$sample.customer_reviews|escape}</textarea>
 		</td>
 	</tr>
    <tr>
	 <td colspan="9" id="sample_consumer_reviews" align="left"> 
	        <!--{foreach from=$sample.customer_reviews_upload item=file}-->
			<span><a href="download.php?id={$file.file_id}" style="color:blue">{$file.file_name}</a>
	        <!-- {if $user.role==USER_CLIENT} -->
	        	<a class="pic_del" style="color:blue"  href="{url app=comupload&act=delete&id=$file.file_id}" onClick="return confirm('{$lang.confirm_del_file}')" title="{$lang.delete}">&nbsp;</a>
	        <!-- {/if} -->
	        &nbsp;&nbsp;<!--{if !$smarty.foreach.last}--></span><!--{/if}-->
			<!--{/foreach}--></td>
	 </tr>

      <tr>
		<th colspan="1" rowspan="2" align="right" >客户备注：</th>
        <td colspan="9" align="left" >
        <textarea name="consumer_remark" id="consumer_remark" style="height:50px; width:99%;" <!-- {if $user.role!=USER_CLIENT} -->readonly<!-- {/if} -->>{$sample.consumer_remark}</textarea>
    </td>
       
      </tr>
      <tr> <td colspan="9" id="sample_consumer_remark" align="left">     
        <!--{foreach from=$sample.consumer_remark_upload item=file}-->
		<span><a href="download.php?id={$file.file_id}">{$file.file_name}</a>
		<!-- {if $user.role==USER_CLIENT} -->
		<a class="pic_del" href="{url app=comupload&act=delete&id=$file.file_id}" onClick="return confirm('{$lang.confirm_del_file}')" title="{$lang.delete}">&nbsp;</a>
        <!-- {/if} -->
		&nbsp;&nbsp;<!--{if !$smarty.foreach.last}--></span><!--{/if}-->
		<!--{/foreach}-->
        
		</td></tr>
	<!-- {/if} -->
      <tr>
        <th rowspan="2" align="right">{$lang.make_panel_reviews}：</th>
      	<td colspan="9" align="left">
      	{if $user.is_factory neq 1 AND ($sample.status eq SAMPLE_STATUS_CREATE OR $sample.status eq SAMPLE_STATUS_APPROVE)}
      	<textarea style="width:99%; height:50px;" name="make_panel_reviews" id="make_panel_reviews">{$sample.make_panel_reviews|escape}</textarea>
      	{else}
      	<div style="width:99%; height:100px;">{$sample.make_panel_reviews|escape}</div>
      	<textarea style="width:99%; height:50px;display: none;" name="make_panel_reviews" id="make_panel_reviews">{$sample.make_panel_reviews|escape}</textarea>
      	{/if}
        
 </td></tr>
 
 <tr>
 <td colspan="9" id="sample_makepanel_filesize" align="left"> 
        {if ($user.role eq USER_MERCHANDISER OR $user.role eq  USER_ASSISTANT) AND ($sample.status eq SAMPLE_STATUS_CREATE OR $sample.status eq SAMPLE_STATUS_APPROVE ) }
       <input type="button" class="btn-3" value="{$lang.upload_enclosure}" onClick="upload_docs({$belongs_sample_makepanel}, {$sample.sample_id});" /><br />
        {else}
        &nbsp;
        {/if}
        <!--{foreach from=$sample.makepanel_files item=file}-->
		<span><a href="download.php?id={$file.file_id}" style="color:blue">{$file.file_name}</a>
        {if ($user.role eq USER_MERCHANDISER OR $user.role eq  USER_ASSISTANT) AND ($sample.status eq SAMPLE_STATUS_CREATE OR $sample.status eq SAMPLE_STATUS_APPROVE ) }
        <a class="pic_del" style="color:blue"  href="{url app=comupload&act=delete&id=$file.file_id}" onClick="return confirm('{$lang.confirm_del_file}')" title="{$lang.delete}">&nbsp;</a>
        {/if}
        &nbsp;&nbsp;<!--{if !$smarty.foreach.last}--></span><!--{/if}-->
		<!--{/foreach}--></td>
 </tr>

      <tr>
             {if $user.is_factory neq 1}
		<th colspan="1" rowspan="2" align="right" >备注：</th>
        <td colspan="9" align="left" >
        <textarea name="customer_reviews_text" id="customer_reviews_text"  style="height:50px; width:99%;">{$sample.customer_reviews_text}</textarea>
    </td>
       
      </tr>
      <tr> <td colspan="9" id="sample_customer_filesize" align="left">     
         {if $user.is_factory neq 1}
        <input type="button" class="btn-3" value="{$lang.upload_enclosure}" onClick="upload_docs({$belongs_sample_customer_reviews}, {$sample.sample_id});" /><br />
        {else}
        &nbsp;
        {/if}
        <!--{foreach from=$sample.customer_reviews_files item=file}-->
		<span><a href="download.php?id={$file.file_id}">{$file.file_name}</a><a class="pic_del" href="{url app=comupload&act=delete&id=$file.file_id}" onClick="return confirm('{$lang.confirm_del_file}')" title="{$lang.delete}">&nbsp;</a>&nbsp;&nbsp;<!--{if !$smarty.foreach.last}--></span><!--{/if}-->
		<!--{/foreach}-->
		{/if}</td></tr>
      <tr>
        <th colspan="1" align="right" style="font-size:12px;">{$lang.fabric_info}：<br></th>
       <td colspan="9" style="margin:0; padding:0;">
       <table width="100%" class="sample_info_table" cellpadding="0" cellspacing="0">
       <th width="15%" class="no_left_border">面料描述</th>
       <th width="25%">{$lang.fabric_shop_name}</th>
       <th width="10%">品名/货号</th>
       <th width="9%" >价格</th>
       <th width="9%" >幅宽</th>
       <th width="7%">色卡</th>
       <th width="9%" class="no_right_border">操作</th>
       <tr class="fabric_info_list center" id="sample_info_list">
       <td>
       <input name="fabric_info_id[]" type="hidden" value="" />
        <input name="cc_id[]" item="cc_id" type="hidden" value="" />
       <input name="description[]" item="description" type="text"  /></td>
       <td align="left">
       <select style="width:95%; height:20px;"  name="fabric_shop_name[]" item="fabric_shop_name" data-placeholder="请选择" class="chzn-select">
       <option value="0" >未选择</option>
      <!--{foreach from=$fabric_shop_list item=fab_shop_info name=fs}-->
		<option value="{$fab_shop_info.fabric_shop_id}"  >{$fab_shop_info.fabric_shop_name}</option>
       <!--{/foreach}-->
       </select>
       </td>    
       <td><select style="width:80px; height:20px;" name="item[]"  item="item" data-placeholder="未选择" >
        <option value="0" >未选择</option>
       </select></td>
       <td><input name="price[]" item="price" type="text" readonly="readonly"  /></td>   
       <td><input name="width[]" item="width" type="text" readonly="readonly" /></td>
       <td><a item="picture_show" cid=""  style="display:none;" href="javascript:;">查看</a></td>
       <td class="no_right_border"><input type="button" item="op" class="btn-2" value="添加" s_id="{$sample.sample_id}" /></td>
       </tr>
      <!--{foreach from=$fabric_info_list item=fabric_info name=fi}-->
       <tr class="fabric_info_list center">
       <td>{$fabric_info.description|escape}</td>
       <td>{$fabric_info.fabric_shop_name}</td>    
       <td>{$fabric_info.item}</td>
       <td>{$fabric_info.price}</td>   
       <td>{$fabric_info.width}</td>
       <td>
      <a  item="picture_show" cid="{$fabric_info.cc_id}"  href="javascript:;">查看</a>
</td>
      <td class="no_right_border"><input type="button" item="op" class="btn-2" value="移除" onClick="remove_fabric_shop(this);" f_id="{$fabric_info.fabric_info_id}"  /></td>

       </tr>
       <!--{/foreach}-->
  
       </table>
       
       </td>
      </tr>
      
     <tr height="45">
     <th colspan="1" align="right">尺寸文件：</th>
     <td colspan="9" style="margin:0; padding:0;">
     <table width="100%" class="table_no_border" border="0" cellpadding="0" cellspacing="0" style="padding:0; margin:0; height:45px;">
     <tr bgcolor="#F5F5F5">
        <td width="119">
		<div id="sample_filesize">
			<input type="button" style="width: 70px" class="btn-3" value="{$lang.upload_enclosure}" onClick="upload_docs({$belongs_sample_filesize}, {$sample.sample_id});" /><br />
			 <!--{foreach from=$sample.file_size item=file_size}-->
		<span><a href="download.php?id={$file_size.file_id}">{$file_size.file_name}</a><a class="pic_del" href="{url app=comupload&act=delete&id=$file_size.file_id}" onClick="return confirm('{$lang.confirm_del_file}')" title="{$lang.delete}">&nbsp;</a>&nbsp;&nbsp;<!--{if !$smarty.foreach.last}--></span><!--{/if}-->
		<!--{/foreach}-->
		</div>
              
        </td>
         <th width="80">{$lang.factory_price}：</th>
        <td width="116"><input type="text" name="factory_price" class="input-7" value="{$sample.factory_price|escape}" />{$lang.rmb_yuan}</td>
        <th width="90">{$lang.quotation}：</th>
        <td width="142"  id="factory_files">
                <input type="button" class="btn-3" value="{$lang.upload_enclosure}" onClick="upload_docs({$belongs_factory}, {$sample.sample_id});" /><br />
        <!--{foreach from=$sample.factory_files item=file}-->
		<span><a target="_blank" href="download.php?id={$file.file_id}">{$file.file_name}</a><a class="pic_del" href="{url app=comupload&act=delete&id=$file.file_id}" onClick="return confirm('{$lang.confirm_del_file}')" title="{$lang.delete}">&nbsp;</a>&nbsp;&nbsp;<!--{if !$smarty.foreach.last}--></span><!--{/if}-->
		<!--{/foreach}-->

        </td>
        
          <th width="118">预计交办日期：</th>
        <td class="no_right_border"><input type="text" name="predict_assign_date" id="predict_assign_date" class="input-7"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="{$sample.predict_assign_date|date:Y-m-d}" />
        </td>
	</tr>
        </table>
        </td>
      </tr>
     
      <tr style="display:none;" class="approve_no_desc_block"><th colspan="1" align="right">审批不通过理由：</th>
      <td colspan="9" align="left">
       <div style="display:none; width:200px; height:300px;" id="block" >
      <textarea style="width:95%; height:60px;" id="approve_no_desc"  name="approve_no_desc"></textarea>
      <textarea style="width:95%; height:60px;" id="return_factory_desc"  name="return_factory_desc"></textarea>
      </div>
      </td>
      </tr>
     <tr height="30">
        <th colspan="1" align="right">进度记录：</th>
        <td colspan="9" align="left">
        <textarea style="width:70%;" id="add_buff"></textarea>
        <input type="button" class="btn-3" value="增加记录" onClick="addbuff();" /><br />
       <table  width="100%"><tr><td id="record_list" width="80%">
        {foreach from=$pro_records_list item=rec_item}
       <p>{$rec_item.rec_time|date:m-d}&nbsp:&nbsp{$rec_item.rec_buff}&nbsp&nbsp({$rec_item.rec_name})</p>
       {/foreach}
       </td><td align="center">       
       {if $sample.status eq SAMPLE_STATUS_CREATE||$sample.status eq SAMPLE_STATUS_APPROVE||$sample.status eq SAMPLE_STATUS_FACTORY_SUBMIT||$sample.status eq SAMPLE_STATUS_SEND_FACTORY||$sample.status eq SAMPLE_STATUS_SEND_SAMPLE}
       <input type="submit" class="btn-2" value="保存资料"><br />
       {/if} 
       
       {if $sample.status eq SAMPLE_STATUS_APPROVE AND ($user.role eq USER_MANAGER || $user.role eq USER_MERCHANDISER_ADMIN)}
       <input type="submit" name="submit" onClick="return check_product_sub()" class="btn-2" value="审批通过"><br />
       <input type="submit" id="sample_approve_notpass" name="submit" onClick="return check_desc()" class="btn-2" value="审批不通过"><br />
       {/if} 
       
       
       <!-- {if $user.role eq USER_MERCHANDISER} -->
        	<input name="factory_quote" value="工厂报价" type="button" class="btn-2" onclick="assign_factory_quote()" /> 
        	<input name="merchant_fabric" value="面料需求" type="button" class="btn-2" onclick="assign_merch_fabric()" />
       <!-- {/if} -->
       {if $user.role eq USER_MANAGER}
		<input name="merchant_fabric" value="面料需求" type="button" class="btn-2" onclick="assign_merch_fabric()" />
		{/if}
       {if $sample.status eq SAMPLE_STATUS_SEND_FACTORY and $user.role eq USER_MERCHANDISER}
       <!-- <input type="button" class="btn-2" value="创建采购单" onclick="get_sours()"><br /> -->
       {/if} 
       
          {if $sample.status eq SAMPLE_STATUS_FACTORY_SUBMIT AND ($user.role eq USER_MANAGER OR $user.role eq USER_MERCHANDISER OR $user.role eq USER_ASSISTANT)}
       <input type="submit" name="submit" id="return_factory" onClick="return re_factory()"  class="btn-2" value="退工厂"><br />

       {/if} 
       
        <input type="button"  class="btn-2" onClick="javascript:window.open('{$site_url}/index.php?app=sample&act=printsample&id={$smarty.get.id}');" value="打印样板"><br />
        {if $sample.status eq SAMPLE_STATUS_CREATE AND $user.role neq USER_MANAGER and $user.role neq USER_MERCHANDISER_ADMIN AND $user.role neq USER_FACTORY}
        <input type="submit" name="submit" class="btn-2" onClick="if(confirm('确认送主管审批吗?确认后做板评语部分将不能修改！')!=true){return false;}" value="送主管审批"/><br />
        {/if} 
        {if $sample.status eq SAMPLE_STATUS_SEND_FACTORY && $user.role eq USER_FACTORY}
        <input type="submit" name="submit" class="btn-2" onClick="if(!check_factory_submit())return false;" value="提交样板"/><br />
        {/if} 
        <!-- {if $sample.factory_id==DEFAULT_FACTORY_ID} -->
        {if $sample.status eq SAMPLE_STATUS_SEND_FACTORY && $user.role eq USER_OUTGOING}
        <input type="submit" name="submit" class="btn-2" onClick="if(!check_factory_submit())return false;" value="提交样板"/><br />
        {/if} 
        <!-- {/if} -->
        {if $sample.status eq  SAMPLE_STATUS_FACTORY_SUBMIT}
        <input type="submit" name="submit" onClick="if(send_sample_date.value==''){alert('请先输入寄板日期!');return false;}"  class="btn-2" value="寄板"/><br />
        {/if}
        <input type="button"  class="btn-2" onClick="history.back();"  value="返回"/>

        </td></tr></table>

        </td>
      </tr>
    </table>
	</form>
  </div>
</div>
<script language="javascript" type="text/javascript" src="{res file=js/tab_color.js}"></script>
<script type="text/javascript">
//客户评语
var customer_reviews = document.getElementById("customer_reviews");
autoTextarea(customer_reviews);// 调用 

//客户备注
var consumer_remark = document.getElementById("consumer_remark");
autoTextarea(consumer_remark);// 调用 

//做板评语
var make_panel_reviews = document.getElementById("make_panel_reviews");
autoTextarea(make_panel_reviews);// 调用 

//备注
var crt = document.getElementById("customer_reviews_text");
autoTextarea(crt);// 调用 
</script>
</body>
{$async_sendmail}
</html>